﻿using System;
using System.IO;

namespace DotNetCoreApi.Util
{
    public static class ConsoleBanner
    {
        public static void SetBanner()
        {
            StreamReader sr = new StreamReader("./wwwroot/banner.txt");
            string content = sr.ReadToEnd();
            sr.Close();
            //随机数
            Random rd = new Random();
            int number = rd.Next(1, 15);
            //设置banner的字体颜色
            Console.ForegroundColor = (ConsoleColor)Enum.ToObject(typeof(ConsoleColor), number);//int转枚举
            Console.WriteLine(content + DateTime.Now);
        }
    }
}
